package edu.bu.cs673.superkids123.children.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import edu.bu.cs673.superkids123.common.model.User;

@Entity
@Table(name="CompletedGames")
public class CompletedGame {
	/**
	 * @author Abdelghani Bhalla
	 */
	
	public CompletedGame(Date startDate, Date endDate, int score, int maxScore,
			int countAnswered, int countNotAnswered, boolean isCompleted) {
		super();
		this.startDate = startDate;
		this.endDate = endDate;
		this.score = score;
		this.maxScore = maxScore;
		this.countAnswered = countAnswered;
		this.countNotAnswered = countNotAnswered;
		this.isCompleted = isCompleted;
	}

	@Id @GeneratedValue
	@Column(name="CompletedGamesID")
	private int id;
	
	@Column(name="GameStartDate")
	private Date startDate;
	
	@Column(name="GameEndDate")
	private Date endDate;
	
	@Column(name="GameScore")
	private int score;
	
	@Column(name="GameMaxScore")
	private int maxScore;
	
	@Column(name="QuestionsAnswered")
	private int countAnswered;
	
	@Column(name="QuestionsNotAnswered")
	private int countNotAnswered;
	
	@Column(name="IsCompleted")
	private boolean isCompleted;
	
	@ManyToOne
	@JoinColumn(name="GameID")
	@NotFound(action=NotFoundAction.IGNORE)
	private Game game;
	
	@ManyToOne
	@JoinColumn(name="UserID")
	@NotFound(action=NotFoundAction.IGNORE)
	private User child;
	
	public User getChild() {
		return child;
	}

	public void setChild(User child) {
		this.child = child;
	}

	public Game getGame() {
		return game;
	}

	public void setGame(Game game) {
		this.game = game;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public int getMaxScore() {
		return maxScore;
	}

	public void setMaxScore(int maxScore) {
		this.maxScore = maxScore;
	}

	public int getCountAnswered() {
		return countAnswered;
	}

	public void setCountAnswered(int countAnswered) {
		this.countAnswered = countAnswered;
	}

	public int getCountNotAnswered() {
		return countNotAnswered;
	}

	public void setCountNotAnswered(int countNotAnswered) {
		this.countNotAnswered = countNotAnswered;
	}

	public boolean isCompleted() {
		return isCompleted;
	}

	public void setCompleted(boolean isCompleted) {
		this.isCompleted = isCompleted;
	}

	public CompletedGame(){
		
	}
	

}
